package bg.cinema_system.global;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionJDBC {

	public static Connection getConnection() {
		ConnProperties connProp = ConnProperties.getInstance();
		String url = "jdbc:mysql://" + connProp.getHostname() + ":"
				+ connProp.getPort() + "/" + connProp.getDatabse();

		Connection connection = null;

		try {
			Class.forName(connProp.getDriver());
			connection = DriverManager.getConnection(url,
					connProp.getUsername(), connProp.getPassword());
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}

		return connection;
	}
}
